package com.sunwayhorizo.health.platform.security.persistent;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

import com.sunwayhorizo.health.platform.util.BeanHelper;

@Entity
@TableGenerator(name = "SecurityPermissionAccount_IdGenerator", table = "ET_Id_Generator", pkColumnName = "pkColumn", valueColumnName = "valueColumn", pkColumnValue = "SECURITY_PERMISSION_ACCOUNT_ID",allocationSize=50)
@Table(name = "SECURITY_PERMISSION_ACCOUNT", schema = "ETS")
public class SecurityPermissionAccount implements java.io.Serializable {
	
	@Id
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "SecurityPermissionAccount_IdGenerator")
	@Column(name = "PERMISSION_ACCOUNT_ID", unique = true, nullable = false, length = 32)
	private String permissionAccountId;
	
	@ManyToOne
	@JoinColumn(name = "ACCOUNT_ID")
	private SecurityAccount account;
	
	@ManyToOne
	@JoinColumn(name = "PERMISSION_ID")
	private SecurityPermission permission;

	public SecurityPermissionAccount() {
	}

	public SecurityPermissionAccount(String permissionAccountId) {
		this.permissionAccountId = permissionAccountId;
	}

	public SecurityPermissionAccount(String permissionAccountId,
			SecurityAccount account,
			SecurityPermission permission) {
		this.permissionAccountId = permissionAccountId;
		this.account = account;
		this.permission = permission;
	}

	public String getPermissionAccountId() {
		return this.permissionAccountId;
	}

	public void setPermissionAccountId(String permissionAccountId) {
		this.permissionAccountId = permissionAccountId;
	}

	public SecurityAccount getAccount() {
		return this.account;
	}

	public void setAccount(SecurityAccount account) {
		this.account = account;
	}

	public SecurityPermission getPermission() {
		return this.permission;
	}

	public void setPermission(SecurityPermission permission) {
		this.permission = permission;
	}
	
	@Override
	public String toString() {
		return BeanHelper.toString(this);
	}
}
